From 9d6aa7d88ee1aeb53c13502b3c33a8eb8465390b Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 23 Oct 2019 15:02:02 +0200 Subject: [PATCH] listbase: Move selection handling here --- gtk/gtkgridview.c | 165 ++----------------------------- gtk/gtklistbase.c | 204 +++++++++++++++++++++++++++++++++++++++ gtk/gtklistbaseprivate.h | 10 ++ gtk/gtklistview.c | 165 ++----------------------------- 4 files changed, 226 insertions(+), 318 deletions(-) diff --git a/gtk/gtkgridview.c b/gtk/gtkgridview.c index c0fa4d136a..c20ffdf31a 100644 --- a/gtk/gtkgridview.c +++ b/gtk/gtkgridview.c @@ -74,8 +74,6 @@ struct _GtkGridView double anchor_yalign; guint anchor_xstart : 1; guint anchor_ystart : 1; - /* the last item that was selected - basically the location to extend selections from */ - GtkListItemTracker *selected; /* the item that has input focus */ GtkListItemTracker *focus; }; @@ -406,25 +404,6 @@ gtk_grid_view_set_anchor (GtkGridView *self, } } -static void -gtk_grid_view_select_item (GtkGridView *self, - guint pos, - gboolean modify, - gboolean extend) -{ - if (gtk_selection_model_user_select_item (gtk_list_item_manager_get_model (self->item_manager), - pos, - modify, - extend ? gtk_list_item_tracker_get_position (self->item_manager, self->selected) - : GTK_INVALID_LIST_POSITION)) - { - gtk_list_item_tracker_set_position (self->item_manager, - self->selected, - pos, - 0, 0); - } -} - static gboolean gtk_grid_view_focus (GtkWidget *widget, GtkDirectionType direction) @@ -476,7 +455,7 @@ moved_focus: } } - gtk_grid_view_select_item (self, + gtk_list_base_select_item (GTK_LIST_BASE (self), gtk_list_item_get_position (GTK_LIST_ITEM (new_focus_child)), modify, extend); @@ -1081,11 +1060,6 @@ gtk_grid_view_dispose (GObject *object) gtk_list_item_tracker_free (self->item_manager, self->anchor); self->anchor = NULL; } - if (self->selected) - { - gtk_list_item_tracker_free (self->item_manager, self->selected); - self->selected = NULL; - } if (self->focus) { gtk_list_item_tracker_free (self->item_manager, self->focus); @@ -1177,46 +1151,6 @@ gtk_grid_view_set_property (GObject *object, } } -static void -gtk_grid_view_select_item_action (GtkWidget *widget, - const char *action_name, - GVariant *parameter) -{ - GtkGridView *self = GTK_GRID_VIEW (widget); - guint pos; - gboolean modify, extend; - - g_variant_get (parameter, "(ubb)", &pos, &modify, &extend); - - gtk_grid_view_select_item (self, pos, modify, extend); -} - -static void -gtk_grid_view_select_all (GtkWidget *widget, - const char *action_name, - GVariant *parameter) -{ - GtkGridView *self = GTK_GRID_VIEW (widget); - GtkSelectionModel *selection_model; - - selection_model = gtk_list_item_manager_get_model (self->item_manager); - - gtk_selection_model_select_all (selection_model); -} - -static void -gtk_grid_view_unselect_all (GtkWidget *widget, - const char *action_name, - GVariant *parameter) -{ - GtkGridView *self = GTK_GRID_VIEW (widget); - GtkSelectionModel *selection_model; - - selection_model = gtk_list_item_manager_get_model (self->item_manager); - - gtk_selection_model_unselect_all (selection_model); -} - static void gtk_grid_view_compute_scroll_align (GtkGridView *self, GtkOrientation orientation, @@ -1363,47 +1297,6 @@ gtk_grid_view_activate_item (GtkWidget *widget, g_signal_emit (widget, signals[ACTIVATE], 0, pos); } -static void -gtk_grid_view_move_to (GtkGridView *self, - guint pos, - gboolean select, - gboolean modify, - gboolean extend) -{ - Cell *cell; - - cell = gtk_list_item_manager_get_nth (self->item_manager, pos, NULL); - if (cell == NULL) - return; - - if (!cell->parent.widget) - { - GtkListItemTracker *tracker = gtk_list_item_tracker_new (self->item_manager); - - /* We need a tracker here to create the widget. - * That needs to have happened or we can't grab it. - * And we can't use a different tracker, because they manage important rows, - * so we create a temporary one. */ - gtk_list_item_tracker_set_position (self->item_manager, tracker, pos, 0, 0); - - cell = gtk_list_item_manager_get_nth (self->item_manager, pos, NULL); - g_assert (cell->parent.widget); - - if (!gtk_widget_grab_focus (cell->parent.widget)) - return; /* FIXME: What now? Can this even happen? */ - - gtk_list_item_tracker_free (self->item_manager, tracker); - } - else - { - if (!gtk_widget_grab_focus (cell->parent.widget)) - return; /* FIXME: What now? Can this even happen? */ - } - - if (select) - gtk_grid_view_select_item (self, pos, modify, extend); -} - static gboolean gtk_grid_view_move_cursor (GtkWidget *widget, GVariant *args, @@ -1439,7 +1332,7 @@ gtk_grid_view_move_cursor (GtkWidget *widget, return TRUE; } - gtk_grid_view_move_to (self, pos + amount, select, modify, extend); + gtk_list_base_grab_focus_on_item (GTK_LIST_BASE (self), pos + amount, select, modify, extend); return TRUE; } @@ -1457,7 +1350,7 @@ gtk_grid_view_move_cursor_to_start (GtkWidget *widget, g_variant_get (args, "(bbb)", &select, &modify, &extend); - gtk_grid_view_move_to (self, 0, select, modify, extend); + gtk_list_base_grab_focus_on_item (GTK_LIST_BASE (self), 0, select, modify, extend); return TRUE; } @@ -1480,7 +1373,7 @@ gtk_grid_view_move_cursor_to_end (GtkWidget *widget, g_variant_get (args, "(bbb)", &select, &modify, &extend); - gtk_grid_view_move_to (self, n_items - 1, select, modify, extend); + gtk_list_base_grab_focus_on_item (GTK_LIST_BASE (self), n_items - 1, select, modify, extend); return TRUE; } @@ -1518,7 +1411,7 @@ gtk_grid_view_move_cursor_page_up (GtkWidget *widget, g_variant_get (args, "(bbb)", &select, &modify, &extend); - gtk_grid_view_move_to (self, new_pos, select, modify, extend); + gtk_list_base_grab_focus_on_item (GTK_LIST_BASE (self), new_pos, select, modify, extend); return TRUE; } @@ -1571,7 +1464,7 @@ gtk_grid_view_move_cursor_page_down (GtkWidget *widget, g_variant_get (args, "(bbb)", &select, &modify, &extend); - gtk_grid_view_move_to (self, new_pos, select, modify, extend); + gtk_list_base_grab_focus_on_item (GTK_LIST_BASE (self), new_pos, select, modify, extend); return TRUE; } @@ -1751,51 +1644,6 @@ gtk_grid_view_class_init (GtkGridViewClass *klass) "u", gtk_grid_view_activate_item); - /** - * GtkGridView|list.select-item: - * @position: position of item to select - * @modify: %TRUE to toggle the existing selection, %FALSE to select - * @extend: %TRUE to extend the selection - * - * Changes selection. - * - * If @extend is %TRUE and the model supports selecting ranges, the - * affected items are all items from the last selected item to the item - * in @position. - * If @extend is %FALSE or selecting ranges is not supported, only the - * item in @position is affected. - * - * If @modify is %TRUE, the affected items will be set to the same state. - * If @modify is %FALSE, the affected items will be selected and - * all other items will be deselected. - */ - gtk_widget_class_install_action (widget_class, - "list.select-item", - "(ubb)", - gtk_grid_view_select_item_action); - - /** - * GtkGridView|list.select-all: - * - * If the selection model supports it, select all items in the model. - * If not, do nothing. - */ - gtk_widget_class_install_action (widget_class, - "list.select-all", - NULL, - gtk_grid_view_select_all); - - /** - * GtkGridView|list.unselect-all: - * - * If the selection model supports it, unselect all items in the model. - * If not, do nothing. - */ - gtk_widget_class_install_action (widget_class, - "list.unselect-all", - NULL, - gtk_grid_view_unselect_all); - /** * GtkGridView|list.scroll-to-item: * @position: position of item to scroll to @@ -1842,7 +1690,6 @@ gtk_grid_view_init (GtkGridView *self) self->anchor = gtk_list_item_tracker_new (self->item_manager); self->anchor_xstart = TRUE; self->anchor_ystart = TRUE; - self->selected = gtk_list_item_tracker_new (self->item_manager); self->focus = gtk_list_item_tracker_new (self->item_manager); self->min_columns = 1; diff --git a/gtk/gtklistbase.c b/gtk/gtklistbase.c index 26ed27e48b..95bdcc347f 100644 --- a/gtk/gtklistbase.c +++ b/gtk/gtklistbase.c @@ -31,6 +31,9 @@ struct _GtkListBasePrivate GtkListItemManager *item_manager; GtkAdjustment *adjustment[2]; GtkScrollablePolicy scroll_policy[2]; + + /* the last item that was selected - basically the location to extend selections from */ + GtkListItemTracker *selected; }; enum @@ -84,6 +87,47 @@ gtk_list_base_clear_adjustment (GtkListBase *self, g_clear_object (&priv->adjustment[orientation]); } +/* + * gtk_list_base_select_item: + * @self: a %GtkListBase + * @pos: item to select + * @modify: %TRUE if the selection should be modified, %FALSE + * if a new selection should be done. This is usually set + * to %TRUE if the user keeps the key pressed. + * @extend_pos: %TRUE if the selection should be extended. + * Selections are usually extended from the last selected + * position if the user presses the key. + * + * Selects the item at @pos according to how GTK list widgets modify + * selections, both when clicking rows with the mouse or when using + * the keyboard. + **/ +void +gtk_list_base_select_item (GtkListBase *self, + guint pos, + gboolean modify, + gboolean extend) +{ + GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self); + GtkSelectionModel *model; + + model = gtk_list_item_manager_get_model (priv->item_manager); + if (model == NULL) + return; + + if (gtk_selection_model_user_select_item (model, + pos, + modify, + extend ? gtk_list_item_tracker_get_position (priv->item_manager, priv->selected) + : GTK_INVALID_LIST_POSITION)) + { + gtk_list_item_tracker_set_position (priv->item_manager, + priv->selected, + pos, + 0, 0); + } +} + static void gtk_list_base_dispose (GObject *object) { @@ -93,6 +137,11 @@ gtk_list_base_dispose (GObject *object) gtk_list_base_clear_adjustment (self, GTK_ORIENTATION_HORIZONTAL); gtk_list_base_clear_adjustment (self, GTK_ORIENTATION_VERTICAL); + if (priv->selected) + { + gtk_list_item_tracker_free (priv->item_manager, priv->selected); + priv->selected = NULL; + } g_clear_object (&priv->item_manager); G_OBJECT_CLASS (gtk_list_base_parent_class)->dispose (object); @@ -208,9 +257,56 @@ gtk_list_base_set_property (GObject *object, } } +static void +gtk_list_base_select_item_action (GtkWidget *widget, + const char *action_name, + GVariant *parameter) +{ + GtkListBase *self = GTK_LIST_BASE (widget); + guint pos; + gboolean modify, extend; + + g_variant_get (parameter, "(ubb)", &pos, &modify, &extend); + + gtk_list_base_select_item (self, pos, modify, extend); +} + +static void +gtk_list_base_select_all (GtkWidget *widget, + const char *action_name, + GVariant *parameter) +{ + GtkListBase *self = GTK_LIST_BASE (widget); + GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self); + GtkSelectionModel *selection_model; + + selection_model = gtk_list_item_manager_get_model (priv->item_manager); + if (selection_model == NULL) + return; + + gtk_selection_model_select_all (selection_model); +} + +static void +gtk_list_base_unselect_all (GtkWidget *widget, + const char *action_name, + GVariant *parameter) +{ + GtkListBase *self = GTK_LIST_BASE (widget); + GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self); + GtkSelectionModel *selection_model; + + selection_model = gtk_list_item_manager_get_model (priv->item_manager); + if (selection_model == NULL) + return; + + gtk_selection_model_unselect_all (selection_model); +} + static void gtk_list_base_class_init (GtkListBaseClass *klass) { + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gpointer iface; @@ -234,6 +330,52 @@ gtk_list_base_class_init (GtkListBaseClass *klass) g_object_interface_find_property (iface, "vscroll-policy")); g_object_class_install_properties (gobject_class, N_PROPS, properties); + + /** + * GtkListBase|list.select-item: + * @position: position of item to select + * @modify: %TRUE to toggle the existing selection, %FALSE to select + * @extend: %TRUE to extend the selection + * + * Changes selection. + * + * If @extend is %TRUE and the model supports selecting ranges, the + * affected items are all items from the last selected item to the item + * in @position. + * If @extend is %FALSE or selecting ranges is not supported, only the + * item in @position is affected. + * + * If @modify is %TRUE, the affected items will be set to the same state. + * If @modify is %FALSE, the affected items will be selected and + * all other items will be deselected. + */ + gtk_widget_class_install_action (widget_class, + "list.select-item", + "(ubb)", + gtk_list_base_select_item_action); + + /** + * GtkListBase|list.select-all: + * + * If the selection model supports it, select all items in the model. + * If not, do nothing. + */ + gtk_widget_class_install_action (widget_class, + "list.select-all", + NULL, + gtk_list_base_select_all); + + /** + * GtkListBase|list.unselect-all: + * + * If the selection model supports it, unselect all items in the model. + * If not, do nothing. + */ + gtk_widget_class_install_action (widget_class, + "list.unselect-all", + NULL, + gtk_list_base_unselect_all); + } static void @@ -248,6 +390,8 @@ gtk_list_base_init_real (GtkListBase *self, g_class->list_item_augment_size, g_class->list_item_augment_func); + priv->selected = gtk_list_item_tracker_new (priv->item_manager); + priv->adjustment[GTK_ORIENTATION_HORIZONTAL] = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0); priv->adjustment[GTK_ORIENTATION_VERTICAL] = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0); @@ -338,3 +482,63 @@ gtk_list_base_get_manager (GtkListBase *self) return priv->item_manager; } +/* + * gtk_list_base_grab_focus_on_item: + * @self: a #GtkListBase + * @pos: position of the item to focus + * @select: %TRUE to select the item + * @modify: if selecting, %TRUE to modify the selected + * state, %FALSE to always select + * @extend: if selecting, %TRUE to extend the selection, + * %FALSE to only operate on this item + * + * Tries to grab focus on the given item. If there is no item + * at this position or grabbing focus failed, %FALSE will be + * returned. + * + * Returns: %TRUE if focusing the item succeeded + **/ +gboolean +gtk_list_base_grab_focus_on_item (GtkListBase *self, + guint pos, + gboolean select, + gboolean modify, + gboolean extend) +{ + GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self); + GtkListItemManagerItem *item; + + item = gtk_list_item_manager_get_nth (priv->item_manager, pos, NULL); + if (item == NULL) + return FALSE; + + if (!item->widget) + { + GtkListItemTracker *tracker = gtk_list_item_tracker_new (priv->item_manager); + + /* We need a tracker here to create the widget. + * That needs to have happened or we can't grab it. + * And we can't use a different tracker, because they manage important rows, + * so we create a temporary one. */ + gtk_list_item_tracker_set_position (priv->item_manager, tracker, pos, 0, 0); + + item = gtk_list_item_manager_get_nth (priv->item_manager, pos, NULL); + g_assert (item->widget); + + if (!gtk_widget_grab_focus (item->widget)) + return FALSE; + + gtk_list_item_tracker_free (priv->item_manager, tracker); + } + else + { + if (!gtk_widget_grab_focus (item->widget)) + return FALSE; + } + + if (select) + gtk_list_base_select_item (self, pos, modify, extend); + + return TRUE; +} + diff --git a/gtk/gtklistbaseprivate.h b/gtk/gtklistbaseprivate.h index 4d0c668291..47fd7f31b8 100644 --- a/gtk/gtklistbaseprivate.h +++ b/gtk/gtklistbaseprivate.h @@ -56,4 +56,14 @@ int gtk_list_base_set_adjustment_values (GtkListBase int size, int page_size); +void gtk_list_base_select_item (GtkListBase *self, + guint pos, + gboolean modify, + gboolean extend); +gboolean gtk_list_base_grab_focus_on_item (GtkListBase *self, + guint pos, + gboolean select, + gboolean modify, + gboolean extend); + #endif /* __GTK_LIST_BASE_PRIVATE_H__ */ diff --git a/gtk/gtklistview.c b/gtk/gtklistview.c index 7974a97357..e547411fa8 100644 --- a/gtk/gtklistview.c +++ b/gtk/gtklistview.c @@ -69,8 +69,6 @@ struct _GtkListView GtkListItemTracker *anchor; double anchor_align; gboolean anchor_start; - /* the last item that was selected - basically the location to extend selections from */ - GtkListItemTracker *selected; /* the item that has input focus */ GtkListItemTracker *focus; }; @@ -694,25 +692,6 @@ gtk_list_view_size_allocate (GtkWidget *widget, } } -static void -gtk_list_view_select_item (GtkListView *self, - guint pos, - gboolean modify, - gboolean extend) -{ - if (gtk_selection_model_user_select_item (gtk_list_item_manager_get_model (self->item_manager), - pos, - modify, - extend ? gtk_list_item_tracker_get_position (self->item_manager, self->selected) - : GTK_INVALID_LIST_POSITION)) - { - gtk_list_item_tracker_set_position (self->item_manager, - self->selected, - pos, - 0, 0); - } -} - static gboolean gtk_list_view_focus (GtkWidget *widget, GtkDirectionType direction) @@ -764,7 +743,7 @@ moved_focus: } } - gtk_list_view_select_item (self, + gtk_list_base_select_item (GTK_LIST_BASE (self), gtk_list_item_get_position (GTK_LIST_ITEM (new_focus_child)), modify, extend); @@ -785,11 +764,6 @@ gtk_list_view_dispose (GObject *object) gtk_list_item_tracker_free (self->item_manager, self->anchor); self->anchor = NULL; } - if (self->selected) - { - gtk_list_item_tracker_free (self->item_manager, self->selected); - self->selected = NULL; - } if (self->focus) { gtk_list_item_tracker_free (self->item_manager, self->focus); @@ -873,46 +847,6 @@ gtk_list_view_set_property (GObject *object, } } -static void -gtk_list_view_select_item_action (GtkWidget *widget, - const char *action_name, - GVariant *parameter) -{ - GtkListView *self = GTK_LIST_VIEW (widget); - guint pos; - gboolean modify, extend; - - g_variant_get (parameter, "(ubb)", &pos, &modify, &extend); - - gtk_list_view_select_item (self, pos, modify, extend); -} - -static void -gtk_list_view_select_all (GtkWidget *widget, - const char *action_name, - GVariant *parameter) -{ - GtkListView *self = GTK_LIST_VIEW (widget); - GtkSelectionModel *selection_model; - - selection_model = gtk_list_item_manager_get_model (self->item_manager); - - gtk_selection_model_select_all (selection_model); -} - -static void -gtk_list_view_unselect_all (GtkWidget *widget, - const char *action_name, - GVariant *parameter) -{ - GtkListView *self = GTK_LIST_VIEW (widget); - GtkSelectionModel *selection_model; - - selection_model = gtk_list_item_manager_get_model (self->item_manager); - - gtk_selection_model_unselect_all (selection_model); -} - static void gtk_list_view_update_focus_tracker (GtkListView *self) { @@ -1052,47 +986,6 @@ gtk_list_view_activate_item (GtkWidget *widget, g_signal_emit (widget, signals[ACTIVATE], 0, pos); } -static void -gtk_list_view_move_to (GtkListView *self, - guint pos, - gboolean select, - gboolean modify, - gboolean extend) -{ - ListRow *row; - - row = gtk_list_item_manager_get_nth (self->item_manager, pos, NULL); - if (row == NULL) - return; - - if (!row->parent.widget) - { - GtkListItemTracker *tracker = gtk_list_item_tracker_new (self->item_manager); - - /* We need a tracker here to create the widget. - * That needs to have happened or we can't grab it. - * And we can't use a different tracker, because they manage important rows, - * so we create a temporary one. */ - gtk_list_item_tracker_set_position (self->item_manager, tracker, pos, 0, 0); - - row = gtk_list_item_manager_get_nth (self->item_manager, pos, NULL); - g_assert (row->parent.widget); - - if (!gtk_widget_grab_focus (row->parent.widget)) - return; /* FIXME: What now? Can this even happen? */ - - gtk_list_item_tracker_free (self->item_manager, tracker); - } - else - { - if (!gtk_widget_grab_focus (row->parent.widget)) - return; /* FIXME: What now? Can this even happen? */ - } - - if (select) - gtk_list_view_select_item (self, pos, modify, extend); -} - static gboolean gtk_list_view_move_cursor (GtkWidget *widget, GVariant *args, @@ -1123,7 +1016,7 @@ gtk_list_view_move_cursor (GtkWidget *widget, if (new_pos >= n_items) return TRUE; - gtk_list_view_move_to (self, new_pos, select, modify, extend); + gtk_list_base_grab_focus_on_item (GTK_LIST_BASE (self), new_pos, select, modify, extend); return TRUE; } @@ -1141,7 +1034,7 @@ gtk_list_view_move_cursor_to_start (GtkWidget *widget, g_variant_get (args, "(bbb)", &select, &modify, &extend); - gtk_list_view_move_to (self, 0, select, modify, extend); + gtk_list_base_grab_focus_on_item (GTK_LIST_BASE (self), 0, select, modify, extend); return TRUE; } @@ -1164,7 +1057,7 @@ gtk_list_view_move_cursor_to_end (GtkWidget *widget, g_variant_get (args, "(bbb)", &select, &modify, &extend); - gtk_list_view_move_to (self, n_items - 1, select, modify, extend); + gtk_list_base_grab_focus_on_item (GTK_LIST_BASE (self), n_items - 1, select, modify, extend); return TRUE; } @@ -1210,7 +1103,7 @@ gtk_list_view_move_cursor_page_up (GtkWidget *widget, g_variant_get (args, "(bbb)", &select, &modify, &extend); - gtk_list_view_move_to (self, pos, select, modify, extend); + gtk_list_base_grab_focus_on_item (GTK_LIST_BASE (self), pos, select, modify, extend); return TRUE; } @@ -1255,7 +1148,7 @@ gtk_list_view_move_cursor_page_down (GtkWidget *widget, g_variant_get (args, "(bbb)", &select, &modify, &extend); - gtk_list_view_move_to (self, pos, select, modify, extend); + gtk_list_base_grab_focus_on_item (GTK_LIST_BASE (self), pos, select, modify, extend); return TRUE; } @@ -1419,51 +1312,6 @@ gtk_list_view_class_init (GtkListViewClass *klass) "u", gtk_list_view_activate_item); - /** - * GtkListView|list.select-item: - * @position: position of item to select - * @modify: %TRUE to toggle the existing selection, %FALSE to select - * @extend: %TRUE to extend the selection - * - * Changes selection. - * - * If @extend is %TRUE and the model supports selecting ranges, the - * affected items are all items from the last selected item to the item - * in @position. - * If @extend is %FALSE or selecting ranges is not supported, only the - * item in @position is affected. - * - * If @modify is %TRUE, the affected items will be set to the same state. - * If @modify is %FALSE, the affected items will be selected and - * all other items will be deselected. - */ - gtk_widget_class_install_action (widget_class, - "list.select-item", - "(ubb)", - gtk_list_view_select_item_action); - - /** - * GtkListView|list.select-all: - * - * If the selection model supports it, select all items in the model. - * If not, do nothing. - */ - gtk_widget_class_install_action (widget_class, - "list.select-all", - NULL, - gtk_list_view_select_all); - - /** - * GtkListView|list.unselect-all: - * - * If the selection model supports it, unselect all items in the model. - * If not, do nothing. - */ - gtk_widget_class_install_action (widget_class, - "list.unselect-all", - NULL, - gtk_list_view_unselect_all); - /** * GtkListView|list.scroll-to-item: * @position: position of item to scroll to @@ -1509,7 +1357,6 @@ gtk_list_view_init (GtkListView *self) self->item_manager = gtk_list_base_get_manager (GTK_LIST_BASE (self)); self->focus = gtk_list_item_tracker_new (self->item_manager); self->anchor = gtk_list_item_tracker_new (self->item_manager); - self->selected = gtk_list_item_tracker_new (self->item_manager); self->orientation = GTK_ORIENTATION_VERTICAL; } -- 2.30.2